const createFlow = require('./flow')
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
// 如果函数返回值是Promise 实例，
// 那么就是thenable
const subFlow = createFlow([
    () => delay(1000).then(()=>console.log('c'))
])

createFlow([
    ()=> console.log("a"),
    ()=> console.log("b"),
    // subFlow,// 递归不是算法，是一种编程技巧
    [
        ()=>delay(1000).then(()=>console.log("d")),
        ()=> console.log("e")
    ]
]).run(()=>{
    console.log("done")
})
// delay(1000)
// // callback
//     .then(() => {
//         console.log(data)
//     })
    // .then()